<template>
	<view class="content">
		<view class="row1">
			<image src="../../../static/icon/filecoin-logo@2x.png" mode=""></image>
			<text>FIL</text>
		</view>
		<view class="erweima">
			<image :src='code_url' mode=""></image>
		</view>
		<view class="line"></view>
		<view class="chongbidizhi">
			<view class="row2">
				<text>充币地址：</text>
				<text class="dizhi">{{address}}</text>
				<text class="xiaoshu"></text>
				<text class="you" @click="copy(address)">复制</text>
			</view>
		</view>
		<view class="mybtn" @click="make">提交充值信息</view>
		<view class="title1">
			扫描二维码获取充币地址
		</view>
		<view class="tishibox">
			<view class="tishi1">
				温馨提示：
			</view>
			<view class="tishi2">
				1、请勿向上述地址充值任何非FIL资产，否则资产将不可
				找回；<br>
				2、请务必确认手机及浏览器安全，防止信息被篡改或泄露；
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				address:'66161664664546666666666666666666',
				code_url:''
			}
		},
		onLoad() {
			this.getinfo()
		},
		methods: {
			getinfo(){
				var token =uni.getStorageSync('token')
				if(token==''||token==null){
					uni.reLaunch({
					    url:'../../login/login'
					})
				}else{
					this.http({
					 	url:'/api/Page/filChargeAddress',
					 	method:'POST',
						header:{
							'token':token
						},
					 	success:(res)=>{
							console.log(res)
							this.address = res.data.address
							this.code_url = 'data:image/jpeg;base64,'+res.data.code_url
						},
					 	error:()=>{
					 		uni.showToast({
					 			title:"请求异常"	
					 		})
					 	},	
					 })
				} 
			},
			make(){
				uni.navigateTo({
					url:'./tijiaochongzhi'
				})
			},
			copy(address){
				var address = this.address;
				uni.showModal({
					content:address,
					confirmText: '复制内容',
					success: () => {
						uni.setClipboardData({
							data: address,
							success:function(){
								uni.showToast({
									title: '复制成功',
								    duration: 2000,
								    icon: 'none'
								});
							}
						})
					}
				})
			},
		}
	}
</script>

<style lang="scss">
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		font-family: PingFang SC;
		font-weight: 500;
		color:#2b2b2b;
		padding-bottom: 50rpx;
		.mybtn{
			width: 690rpx;
			height: 88rpx;
			margin: 30rpx auto;		
			background: #0072FF;
			border-radius: 15rpx;
			font-size: 36rpx;
			text-align: center;
			font-family: PingFang SC;
			font-weight: bold;
			color: #FFFFFF;
			line-height:88rpx ;	
			letter-spacing: 5px;
		}
		.row1{
			width: 750rpx;
			height: 91rpx;
			border-top: 1rpx solid #cccccc;
			border-bottom: 1rpx solid #cccccc;
			margin: 20rpx auto 68rpx auto;
			display: flex;
			align-items: center;
			font-size: 30rpx;
			font-weight: bold;
			image{
				margin:0 19rpx 0 60rpx;
				width: 45rpx;
				height: 44rpx;
			}
		}
		.erweima{
			width: 319rpx;
			height: 319rpx;
			image{
				width: 319rpx;
				height: 319rpx;
			}
		}
		.line{
			width: 750rpx;
			height: 1rpx;
			background: #CCCCCC;
			margin: 68rpx auto 20rpx auto;
		}
		.chongbidizhi{
			.row2{
				width: 688rpx;
				height: 30rpx;
				margin: 0 auto;
				display: flex;
				align-items: center;
				.dizhi{
					flex: 1;
					overflow: hidden;
					text-overflow:ellipsis;
					white-space: nowrap;
				}
				.xiaoshu{
					width: 4rpx;
					height: 30rpx;
					background: #2B2B2B;
					margin: 0 20rpx 0 17rpx;
				}

			}
		}
		.title1{
			font-size: 24rpx;
			font-weight: 400;
			color: #CCCCCC;
			text-align: center;
			margin: 39rpx auto;
		}
		.tishibox{
			width: 690rpx;
			.tishi1{
				font-size: 28rpx;
				color: #CCCCCC;
			}
			.tishi2{
				margin: 20rpx auto;
				font-size: 26rpx;
				color: #CCCCCC;
			}
		}
	}

	
</style>
